<!DOCTYPE html>
<html lang="en">

<head>
   <meta charset="utf-8">
   <link rel="stylesheet" href="/css/AdminUser/adminuser.css">
   <link rel="stylesheet" href="/css/HomeUser/userinfo.css">
   <!-- 公共 cs 文件 -->
   <%- include('../commont/Link'); %>
   <title>商家餐品列表</title>
</head>

<body>
   <!-- 公共的部分 -->
   <%- include('../commont/Header', {user: user}); %>

   <!-- 主体部分 -->
   <div id="mws-wrapper">
      <!-- 左侧导航 -->
      <%- include('../commont/Navigator', {curNav: curNav}); %>
      <div id="mws-container" class="clearfix">
         <!-- 内容区域 -->
         <div class="container">
            <!-- 会员用户展示列表 -->

            <div class="mws-panel grid_8">
               <div class="mws-panel-header">
                  <span><i class="icon-table"></i>商家餐品列表</span>
               </div>
               <div class="mws-panel-body no-padding">
                  <div id="DataTables_Table_1_wrapper" class="dataTables_wrapper" role="grid">
                     <div id="DataTables_Table_1_length" class="dataTables_length">
                        <label>显示
                           <select size="1" name="DataTables_Table_1_length" aria-controls="DataTables_Table_1" id="selectId">
                              <option value="6">6</option>
                              <option value="4">4</option>
                              <option value="2">2</option>
                           </select>条
                        </label>
                     </div>
                     <div class="dataTables_filter" id="DataTables_Table_1_filter">
                        <form action="/storegoods/search" method="GET">
                           <label>搜索: 
                              <input type="text" aria-controls="DataTables_Table_1" name="kwd">
                           </label>
                           <button type="submit" class="btn btn-primary btn-small">搜索</button>
                        </form>
                     </div>
                     <!-- 表格 -->
                     <table class="mws-table">
                        <thead>
                           <tr>
                              <th>序号</th>
                              <th>食品名称</th>
                              <th>食品图片</th>
                              <th>食品描述</th>
                              <th>食品价格</th>
                              <th>所属商家</th>
                              <th>操作</th>
                           </tr>
                        </thead>
                        <tbody>
                           <% data.forEach((v,i)=> { %>
                              <tr align="center">
                                 <td><%= i + 1 %></td>
                                 <td><%= v.foodname %></td>
                                 <td class="user-pic">
                                    <!-- 如用户上传 logo 则使用用户 logo, 不上传则使用默认 -->
                                    <img src="<%= v.foodpic === 'default.webp' ? '/images/default.webp' : host + v.foodpic %>" alt="">
                                 </td>
                                 <td><%= v.descr %></td>
                                 <td><%= v.price %></td>
                                 <td><%= v.shopname %></td>
                                 <td>
                                    <span class="btn-group">
                                       <button href="#" class="btn btn-small btn-danger btn-del"
                                          data-url="/storegoods/goodsdel?id=<%= v.id %>&foodpic=<%= v.foodpic %>"
                                          title="删除">
                                          <i class="icon-trash"></i>
                                       </button>
                                       <a href="/storegoods/goodsupdate?id=<%= v.id %>&shopname=<%= v.shopname %>" class="btn btn-small btn-primary" style="margin-left: 4px;" title="修改">
                                          <i class="icon-pencil-2"></i>
                                       </a>
                                    </span>
                                 </td>
                              </tr>
                           <%})%>
                        </tbody>
                     </table>
                     <div class="dataTables_info" id="DataTables_Table_1_info">显示 
                        <span class="start">1</span> 到 <span class="end"><%= data.length %></span> 总共 
                        <span class="total" data-total="<%= totalNum %>"><%= totalNum %></span> 条</div>
                     <div class="dataTables_paginate paging_full_numbers" id="DataTables_Table_1_paginate">
                        <a tabindex="0" class="first paginate_button" id="DataTables_Table_1_first">首页</a>
                        <a tabindex="0" class="previous paginate_button" id="DataTables_Table_1_previous">上一页</a>
                        <span id="pages-tool">
                           <% for (let i = 0; i < totalNum / data.length; i++ ) { %>
                              <a tabindex="0" class="paginate_active"><%= i+1 %></a>
                           <% }%>
                        </span>
                        <a tabindex="0" class="next paginate_button" id="DataTables_Table_1_next">下一页</a>
                        <a tabindex="0" class="last paginate_button" id="DataTables_Table_1_last">尾页</a>
                     </div>
                  </div>
               </div>
            </div>
         </div>

         <!-- 中框底部区域 -->
         <%- include('../commont/Footer'); %>
      </div>
   </div>

   <!-- 用户头像预览 -->
   <div id="user-info-pic">
      <div class="mws-panel grid_4">
         <div class="mws-panel-header">
            <span>头像预览</span>
            <div class="mws-collapse-button mws-inset btn-close"><span></span></div>
         </div>
         <div class="mws-panel-body">
            <img src="<%= data.pic %>" alt="">
         </div>
      </div>
   </div>

   <!-- 公共 js 文件 -->
   <%- include('../commont/Script'); %>
   <script src="/js/StoreGoods/storegoods.js"></script>
   <script src="/js/HomeUser/userinfo.js"></script>
   <script src="/js/common/dodel.js"></script>
</body>

</html>